<?php
if (! defined ( 'BASEPATH' ))
	exit ( 'No direct script access allowed' );

define ( 'SELF_PATH', str_replace ( 'Smarty.php', '', str_replace ( '\\', '/', __FILE__ ) ) );
require_once SELF_PATH . 'smarty/Smarty.class.php';
class CI_Smarty {
	private $tpl;
	public function __construct($params = array()) {
		$tpl = new Smarty ();
		$tpl->template_dir = $params ['template_dir'];
		$tpl->compile_dir = $params ['compile_dir'];
		$tpl->config_dir = $params ['config_dir'];
		$tpl->cache_dir = $params ['cache_dir'];
		$tpl->caching = 0;
		$tpl->cache_lifetime = 60 * 60 * 24;
		$tpl->left_delimiter = '{{';
		$tpl->right_delimiter = '}}';
		$tpl->error_reporting = E_ALL & ~E_NOTICE;
		$this->tpl = $tpl;
	}
	
	public function assign($name, $value) {
		$this->tpl->assign ( $name, $value );
	}
	
	public function display($tplname) {
		$this->tpl->display($tplname.'.html');
	}
	public function fetch($tplname) {
		$this->tpl->fetch($tplname.'.html');
	}
}
